package com.mdd.front.service.impl.yangyangLeadingEnterprise;

import com.mdd.common.entity.yangyangLeadingEnterprise.TAppProblemFeedback;
import com.mdd.common.entity.yangyangLeadingEnterprise.common.JsonReturn;
import com.mdd.common.entity.yangyangLeadingEnterprise.param.ProblemFeedbackParam;
import com.mdd.common.mapper.yangyangLeadingEnterprise.TAppProblemFeedbackMapper;
import com.mdd.front.service.yangyangLeadingEnterprise.ITAppProblemFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * 问题反馈实现类
 * @author LikeAdmin
 */
@Service
public class TAppProblemFeedbackServiceImpl implements ITAppProblemFeedbackService {
        
    @Resource
    TAppProblemFeedbackMapper appProblemFeedbackMapper;

    /**
     * 添加问题反馈
     * @param param
     * @return
     */
    @Override
    public String insertProblemFeedback(ProblemFeedbackParam param) {
        Integer type = param.getType();
        String content = param.getContent();
        Long userId = param.getUserId();
        if(type==null || content==null || content.isEmpty() || userId==null){
            return JsonReturn.fail("必传参数不能为空！",40001).toJsonStr();
        }
        TAppProblemFeedback model = new TAppProblemFeedback();
        model.setType(type);
        model.setContent(content);
        model.setCreateTime(new Date());
        model.setUpdateTime(new Date());
        model.setIsDelete(1);
        model.setUserId(userId);
        appProblemFeedbackMapper.insert(model);
        return JsonReturn.success().toJsonStr();
    }
}
